<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<?php  
		require_once ".\system\dbConn.php"; 
		$username=$_POST["username"];
		$password=$_POST["password"];
		$sql="select * from users where username='$username' and password=md5('$password') ";
		$result=mysqli_query($link,$sql);

		$num=mysqli_num_rows($result);
		if ($num>0) {
			//将管理员的名字和adminid记录到session中
			$row=mysqli_fetch_assoc($result);
			session_start();//开启session
			$_SESSION["username"]=$username;
			echo "login success";
			
			header("location:index.php");
		}else{
			echo "login fail";
			header("location:index.php");
		}

	?>
	
</body>
</html>